package com.ruiyian.common.kafka;

import com.ruiyian.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/kafka")
public class KafkaPortController {

    @Autowired
    private KafkaSender kafkaSender;

    @GetMapping("/sendAsynchronize")
    public AjaxResult sendAsynchronize(String topic, String message){

        kafkaSender.sendAsynchronize(topic, message);

        return AjaxResult.success();
    }


    @GetMapping("/sendSynchronize")
    public AjaxResult sendSynchronize(String topic, String message) throws Exception {

        kafkaSender.sendSynchronize(topic, message);

        return AjaxResult.success();
    }

}
